package org.gbif.metrics.cli;

import org.gbif.cli.Command;
import org.gbif.cli.service.ServiceCommand;

import com.google.common.util.concurrent.Service;
import org.kohsuke.MetaInfServices;

/**
 * A container of commands that are annotated such that they will be picked up by the CLI framework and expose the
 * services that can be run.
 */
public class Application {

  @MetaInfServices(Command.class)
  public static class DensityCubeCommand extends ServiceCommand {

    private final DensityCubeConfiguration configuration = new DensityCubeConfiguration();

    public DensityCubeCommand() {
      super("DensityCube");
    }

    @Override
    protected Object getConfigurationObject() {
      return configuration;
    }

    @Override
    protected Service getService() {
      return new DensityCubeUpdaterService(configuration);
    }
  }

  @MetaInfServices(Command.class)
  public static class OccurrenceCubeCommand extends ServiceCommand {

    private final CubeConfiguration configuration = new CubeConfiguration();

    public OccurrenceCubeCommand() {
      super("OccurrenceCube");
    }

    @Override
    protected Object getConfigurationObject() {
      return configuration;
    }

    @Override
    protected Service getService() {
      return new OccurrenceCubeUpdaterService(configuration);
    }
  }
}
